package entity;

import java.io.Serializable;
import java.util.Date;

/**
 * 用户实体
 * @author 李恒
 */
public class User implements Serializable {
    /**
     * 主键
     */
    private Integer id;
    /**
     * 用户名
     */
    private String username;
    /**
     * 密码
     */
    private String password;
    /**
     * 性别
     */
    private String sex;
    /**
     * 学历
     */
    private String edu;
    /**
     * 爱好
     */
    private String[] hobbies;
    /**
     * 简介
     */
    private String description;
    /**
     * 注册时间
     */
    private Date registDate;
    /**
     * 状态
     */
    private String status;

    public static final String HOBBIES_SPLIT=",";

    public User() {
    }


    public String getHob(){
        if(hobbies!=null){
            return String.join(HOBBIES_SPLIT,hobbies);
        }
        return null;
    }

    public void setHob(String hob){
        if(hob!=null){
            hobbies=hob.split(HOBBIES_SPLIT);
        }
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getEdu() {
        return edu;
    }

    public void setEdu(String edu) {
        this.edu = edu;
    }

    public String[] getHobbies() {
        return hobbies;
    }

    public void setHobbies(String[] hobbies) {
        this.hobbies = hobbies;
    }

    public String getDescription() {
        return description;
    }

    public void setDescription(String description) {
        this.description = description;
    }

    public Date getRegistDate() {
        return registDate;
    }

    public void setRegistDate(Date registDate) {
        this.registDate = registDate;
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }
}
